<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset= utf-8" />
        <title>Đăng nhập</title>
        <link href="css/loginmodule.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
	<div id="dlogin">
        
        <p>
            <h3 style="text-align: center; color: red"> Đăng nhập</h3>
        </p>
        <p style="text-align: center"> <lable id="error"></lable></p>

        <form id="loginForm" onsubmit="return validateForm();" name="loginForm" method="post" action="login-exec.php">
            <table width="300" border="0" align="center" cellpadding="2" cellspacing="0">
                <tr>
                    <td width="112"><b>Tài khoản</b></td>
                    <td width="188"><input name="login" type="text" class="textfield" id="login" /></td>
                </tr>
                <tr>
                    <td><b>Mật khẩu</b></td>
                    <td><input name="password" type="password" class="textfield" id="password" /></td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td><input type="submit" name="Submit" value="Đăng nhập" /></td>
                </tr>
            </table>
        </form>

        <script type='text/javascript'>

            function validateForm(){
                // Make quick references to our fields
                var title = document.getElementById('login');
                var content = document.getElementById('password');	
                // Check each input in the order that it appears in the form!
                if(isEmpty(title, "*Chưa nhập tài khoản") || isEmpty(content,"*Chưa nhập mật khẩu")){
                    return false;
                }
                return true;
	
            }

            function isEmpty(elem, helperMsg){
                if(elem.value.length == 0){
                    var errorLable = document.getElementById('error');
                    errorLable.innerHTML = helperMsg;
                    errorLable.style.fontWeight = "Bold";
                    errorLable.style.color = "Red";
                    errorLable.style.fontFamily="arial,sans-serif";
                    errorLable.style.fontSize = "10px";
            
                    //alert(helperMsg);
                    elem.focus(); // set the focus to this input
                    return true;
                }
                return false;
            }

        </script>
	</div>
    </body>
</html>
